//
//  CZQBarcodeController.m
//  weibo
//
//  Created by Apple on 15-1-31.
//  Copyright (c) 2015年 itcast. All rights reserved.
//

#import "CZQBarcodeController.h"

@interface CZQBarcodeController ()
@property (weak, nonatomic) IBOutlet NSLayoutConstraint *layoutConstraintY;
@property (weak, nonatomic) IBOutlet UIBarButtonItem *close;
- (IBAction)close:(id)sender;

@end

@implementation CZQBarcodeController

- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{
    self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
    if (self) {
        // Custom initialization
    }
    return self;
}

- (void)viewDidLoad
{
    [super viewDidLoad];
    CADisplayLink *link  = [CADisplayLink displayLinkWithTarget:self selector:@selector(run)];
    [link addToRunLoop:[NSRunLoop mainRunLoop] forMode:NSRunLoopCommonModes];


}

- (void)run{
    
    self.layoutConstraintY.constant += 5;
    if (self.layoutConstraintY.constant >= 124) {
        self.layoutConstraintY.constant = -124;
    }


}

- (IBAction)close:(id)sender {
    [self dismissViewControllerAnimated:YES completion:nil];
}
@end
